package cn.iocoder.yudao.module.aiposter;

import cn.iocoder.yudao.module.aiposter.config.ExecutorPoolConfig;
import cn.iocoder.yudao.module.aiposter.config.PosterConfig;
import cn.iocoder.yudao.module.aiposter.remote.DrawClient;
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.web.client.RestTemplate;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseTestApplication.Application.class)
@ActiveProfiles("unit-test")
public class BaseTestApplication {

    @Import({
            RestTemplateAutoConfiguration.class,
            PosterConfig.class,
            DrawClient.class,
            ExecutorPoolConfig.class
    })
    public static class Application {
        /**
         * 创建 RestTemplate 实例
         *
         * @param restTemplateBuilder {@link RestTemplateAutoConfiguration#restTemplateBuilder}
         */
        @Bean
        public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
            return restTemplateBuilder.build();
        }
    }

}
